package cool.zhang.repository;

import cool.zhang.model.Movie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;

/**
 * Created by zhang on 2017/3/10.
 */
@Repository
public class MovieDao {

    @Autowired
    RedisTemplate<Object,Object> redisTemplate;

    @Resource(name = "redisTemplate")
    ValueOperations<Object,Object> valueOperations;

    public void save(Movie movie){
        valueOperations.set(movie.getId(),movie);
    }

    public Movie getMovie(Integer id){
        return (Movie)valueOperations.get(id);
    }
}
